﻿from pycad.system import *
from pycad.runtime import *

#linq支持
import clr
import System
clr.ImportExtensions(System.Linq)

@lisp("lisptest")
@showtime
def mylisp(lst):
    from System.Diagnostics import Process
    return [x.ProcessName for x in Process.GetProcesses()]

@lisp()
def mylisp0(lst):
    return lst

@lisp()
def mylisp1(lst):
    return sorted(lst)

@lisp()
def mylisp2(lst):
    return sum(xrange(lst[0]))

@lisp()
def mylisp3(lst):
    from pytest.forms.WpfTestForm import WpfTestForm
    acap.Application.ShowModalDialog(WpfTestForm())
    return utils.getvalue('WpfTestForm')

@lisp()
def mylisp4(lst):
    return flatten([1,[2,3],4,[5,6,[7,8,[9]]]])